<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            background-color: pink;
            height: 200px;
            display: none;
            margin-bottom: 10px;
        }
    </style>
    <script>
        window.onload = function(){
            document.getElementById("btnShow").onclick = function(){
                var divs = document.getElementsByTagName("div");
                for(var i = 0;i<divs.length;i++) {
                    divs[i].style.display = "block";
                }
            }

            document.getElementById("btnset").onclick = function(){
                var divs = document.getElementsByTagName("div");
                for(var i = 0;i<divs.length;i++) {
                    divs[i].innerHTML = "我是内容";
                }
            }
        }

        //会进行叠代，最后只会执行最后一个
       /* window.onload = function(){
            alert("第二个");
        }
        window.onload = function(){
            alert("第三个");
        }*/
    </script>
</head>
<body>
<input type="button" value="设置内容" id="btnset">
<input type="button" value="显示DIV " id="btnShow">
<div></div>
<div></div>
<div></div>
</body>
</html>